package com.aspose.cells;

class zaqk {
   private zapy a;
   private zcfw b;
   private Font c;
   private static final com.aspose.cells.b.c.a.za d = new com.aspose.cells.b.c.a.za(new String[]{"master-page", "name", "page-layout-name", "header", "header-left", "footer", "footer-left", "display", "span", "p", "region-left", "region-right", "region-center", "style-name", "page-number", "page-count", "sheet-name", "date", "time", "file-name"});

   zaqk(zapy var1) {
      this.a = var1;
   }

   void a(zcfw var1) throws Exception {
      this.b = var1;
      if (var1.n()) {
         var1.a();
      } else {
         var1.d();

         while(zass.a(var1)) {
            switch(d.a(var1.p())) {
            case 0:
               this.a();
               break;
            default:
               var1.a();
            }
         }

      }
   }

   private void a() throws Exception {
      if (this.b.n()) {
         this.b.a();
      } else {
         zaqa var1 = new zaqa();
         if (this.b.m()) {
            while(this.b.l()) {
               switch(d.a(this.b.p())) {
               case 1:
                  var1.a = this.b.s();
                  break;
               case 2:
                  var1.b = this.b.s();
               }
            }

            this.b.k();
         }

         this.a.l.put(var1.a, var1);
         this.b.d();

         while(zass.a(this.b)) {
            this.c = null;
            switch(d.a(this.b.p())) {
            case 3:
               if (var1.e == null) {
                  var1.e = new String[3];
               }

               this.a(var1.e);
               break;
            case 4:
               if (var1.g == null) {
                  var1.g = new String[3];
               }

               if (this.a(var1.g)) {
                  var1.c = true;
               }
               break;
            case 5:
               if (var1.f == null) {
                  var1.f = new String[3];
               }

               this.a(var1.f);
               break;
            case 6:
               if (var1.h == null) {
                  var1.h = new String[3];
               }

               if (this.a(var1.h)) {
                  var1.d = true;
               }
            }
         }

      }
   }

   private boolean a(String[] var1) throws Exception {
      boolean var2 = true;
      if (this.b.n()) {
         this.b.a();
         return false;
      } else {
         if (this.b.m()) {
            while(this.b.l()) {
               switch(d.a(this.b.p())) {
               case 7:
                  var2 = Boolean.parseBoolean(this.b.s());
               }
            }

            this.b.k();
         }

         StringBuilder var3 = new StringBuilder();
         this.c = null;
         this.b.d();

         while(true) {
            while(zass.a(this.b)) {
               switch(d.a(this.b.p())) {
               case 8:
                  String var4 = null;
                  if (this.b.m()) {
                     while(this.b.l()) {
                        switch(d.a(this.b.p())) {
                        case 13:
                           var4 = this.b.s();
                        }
                     }

                     this.b.k();
                  }

                  this.a(var3);
                  break;
               case 9:
                  this.a(var3);
                  break;
               case 10:
                  this.a(var1, 0);
                  break;
               case 11:
                  this.a(var1, 2);
                  break;
               case 12:
                  this.a(var1, 1);
               }
            }

            if (var3.length() != 0) {
               var1[1] = com.aspose.cells.b.a.zr.a(var3);
            }

            return var2;
         }
      }
   }

   private void a(String[] var1, int var2) throws Exception {
      if (this.b.n()) {
         this.b.a();
      } else {
         StringBuilder var3 = new StringBuilder();
         this.c = null;
         this.b.d();

         while(true) {
            while(zass.a(this.b)) {
               switch(d.a(this.b.p())) {
               case 8:
                  String var4 = null;
                  if (this.b.m()) {
                     while(this.b.l()) {
                        switch(d.a(this.b.p())) {
                        case 13:
                           var4 = this.b.s();
                        }
                     }

                     this.b.k();
                  }

                  Font var5 = null;
                  if (var4 != null) {
                     var5 = (Font)this.a.o.b.get(var4);
                  }

                  this.a(this.c, var5, var3);
                  this.c = var5;
                  this.a(var3);
                  break;
               case 9:
                  if (var3.length() != 0) {
                     var3.append('\n');
                  }

                  this.a(var3);
               }
            }

            if (var3 != null && var3.length() != 0) {
               var1[var2] = com.aspose.cells.b.a.zr.a(var3);
            }

            return;
         }
      }
   }

   private void a(StringBuilder var1) throws Exception {
      if (this.b.n()) {
         this.b.a();
      } else {
         this.b.d();

         while(true) {
            while(this.b.r() != 4) {
               this.b.j();
               if (this.b.r() != 1) {
                  String var5 = com.aspose.cells.b.a.zv.a(this.b.s(), "&", "&&");
                  if (var5.length() > 1 && var5.charAt(0) >= '0' && var5.charAt(0) <= '9') {
                     boolean var6 = false;

                     for(int var7 = var1.length() - 1; var7 >= 0; --var7) {
                        if (var1.charAt(var7) == '&') {
                           var6 = true;
                           break;
                        }

                        if (var1.charAt(var7) < '0' || var1.charAt(var7) > '9') {
                           break;
                        }
                     }

                     if (var6) {
                        var1.append(' ');
                     }
                  }

                  var1.append(var5);
                  this.b.a();
               } else {
                  switch(d.a(this.b.p())) {
                  case 8:
                     String var3 = null;
                     if (this.b.m()) {
                        while(this.b.l()) {
                           switch(d.a(this.b.p())) {
                           case 13:
                              var3 = this.b.s();
                           }
                        }

                        this.b.k();
                     }

                     Font var4 = null;
                     if (var3 != null) {
                        var4 = (Font)this.a.o.b.get(var3);
                     }

                     this.a(this.c, var4, var1);
                     this.c = var4;
                     this.a(var1);
                     break;
                  case 9:
                     if (var1.length() != 0) {
                        var1.append('\n');
                     }

                     this.a(var1);
                     break;
                  case 10:
                  case 11:
                  case 12:
                  case 13:
                  default:
                     this.b.a();
                     break;
                  case 14:
                     var1.append("&P");
                     this.b.a();
                     break;
                  case 15:
                     var1.append("&N");
                     this.b.a();
                     break;
                  case 16:
                     var1.append("&A");
                     this.b.a();
                     break;
                  case 17:
                     var1.append("&D");
                     this.b.a();
                     break;
                  case 18:
                     var1.append("&T");
                     this.b.a();
                     break;
                  case 19:
                     boolean var2 = false;
                     if (this.b.m()) {
                        while(this.b.l()) {
                           switch(d.a(this.b.p())) {
                           case 7:
                              var2 = "full".equals(this.b.s());
                           }
                        }

                        this.b.k();
                     }

                     if (var2) {
                        var1.append("&Z");
                     } else {
                        var1.append("&F");
                     }

                     this.b.a();
                  }
               }
            }

            this.b.h();
            return;
         }
      }
   }

   private void a(Font var1, Font var2, StringBuilder var3) {
      if (var1 != null || var2 != null) {
         if (var1 == null && var2 != null) {
            if (!com.aspose.cells.b.a.zv.b(var2.getName(), this.a.b.getWorksheets().G().getName())) {
               var3.append("&\"");
               var3.append(var2.getName());
               var3.append("\"");
            }

            if (var2.f(12)) {
               var3.append("&");
               var3.append(var2.getSize());
            }

            if (var2.isBold()) {
               var3.append("&B");
            }

            if (var2.isItalic()) {
               var3.append("&I");
            }

            switch(var2.getUnderline()) {
            case 1:
            case 3:
               var3.append("&U");
               break;
            case 2:
            case 4:
               var3.append("&E");
            }

            if (var2.isStrikeout()) {
               var3.append("&S");
            }

            if (var2.isSubscript()) {
               var3.append("&Y");
            }

            if (var2.isSuperscript()) {
               var3.append("&X");
            }

         } else if (var1 != null && var2 == null) {
            if (var1.isBold()) {
               var3.append("&B");
            }

            if (var1.isItalic()) {
               var3.append("&I");
            }

            switch(var1.getUnderline()) {
            case 1:
            case 3:
               var3.append("&U");
               break;
            case 2:
            case 4:
               var3.append("&E");
            }

            if (var1.isStrikeout()) {
               var3.append("&S");
            }

            if (var1.isSubscript()) {
               var3.append("&Y");
            }

            if (var1.isSuperscript()) {
               var3.append("&X");
            }

         } else if (!var1.a(var2)) {
            if (var1.isSubscript() && !var2.isSubscript()) {
               var3.append("&X");
            }

            if (var1.isSuperscript() && !var2.isSuperscript()) {
               var3.append("&Y");
            }

            if (var1.isStrikeout() && !var2.isStrikeout()) {
               var3.append("&S");
            }

            if (var1.getUnderline() != var2.getUnderline()) {
               switch(var1.getUnderline()) {
               case 1:
               case 3:
                  var3.append("&U");
                  break;
               case 2:
               case 4:
                  var3.append("&E");
               }
            }

            if (var1.isItalic() && !var2.isItalic()) {
               var3.append("&I");
            }

            if (var1.isBold() && !var2.isBold()) {
               var3.append("&B");
            }

            if (!com.aspose.cells.b.a.zv.b(var1.getName(), var2.getName())) {
               var3.append("&\"");
               var3.append(var2.getName());
               var3.append("\"");
            }

            if (var1.getSize() != var2.getSize()) {
               var3.append("&");
               var3.append(var2.getSize());
            }

            if (var2.isItalic() && !var1.isItalic()) {
               var3.append("&I");
            }

            if (var2.isBold() && !var1.isBold()) {
               var3.append("&B");
            }

            if (var2.getUnderline() != var1.getUnderline()) {
               switch(var2.getUnderline()) {
               case 1:
               case 3:
                  var3.append("&U");
                  break;
               case 2:
               case 4:
                  var3.append("&E");
               }
            }

            if (var2.isStrikeout() && !var1.isStrikeout()) {
               var3.append("&S");
            }

            if (var2.isSubscript() && !var1.isSubscript()) {
               var3.append("&Y");
            }

            if (var2.isSuperscript() && !var1.isSuperscript()) {
               var3.append("&X");
            }

            if (var2.f(16)) {
               var3.append("&");
               var3.append(zaqh.a(var2.getColor()));
            }

         }
      }
   }
}
